﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Skywave.ComponentModel
{
    public abstract class PathProvider
    {
        string path_Base = "";
        public PathProvider(string basePath)
        {
            path_Base = basePath;
            if (!path_Base.EndsWith("\\"))
                path_Base += "\\";
            //
            if (!System.IO.Directory.Exists(path_Base))
                System.IO.Directory.CreateDirectory(path_Base);
        }

        public string GetDirectory(string relativeToStartPath, bool createIfNotExists = true)
        {
            string r = string.Format("{0}{1}\\", path_Base, relativeToStartPath);
            if (createIfNotExists && !System.IO.Directory.Exists(r))
                System.IO.Directory.CreateDirectory(r);
            return r;
        }

        /// <summary>
        /// Directory_Start Property
        /// </summary>
        public string Directory_Start
        {
            get { return path_Base; }
        }
    }
}
